package com.changan.utils;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClient;
import com.aliyun.oss.OSSClientBuilder;
import com.changan.entity.OssEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class OssClientUtil {

    @Autowired
    private OssEntity ossEntity;

//    public OssClientUtil(OssEntity ossEntity){
//        this.ossEntity = ossEntity;
//    }

    public OSS getOssClient(){
        OSS ossClient = new OSSClientBuilder().build(ossEntity.getEndpoint(), ossEntity.getAccessKeyId(), ossEntity.getAccessKeySecret());
        return ossClient;
    }
}
